package com.dongdongshop.config;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AliPayConfig {
    @Value("${alipay.serverUrl}")
    private String serverUrl;

    @Value("${alipay.public_key}")
    private String public_key;

    @Value("${alipay.charset}")
    private String charset;

    @Value("${alipay.sign_type}")
    private String sign_type;

    @Value("${alipay.format}")
    private String format;

    @Value("${alipay.private_key}")
    private String private_key;

    @Value("${alipay.appId}")
    private String appId;

    @Bean
    public AlipayClient alipayClient(){
        AlipayClient alipayClient =new DefaultAlipayClient(serverUrl,appId,private_key,format,charset,public_key,sign_type);
        return alipayClient;
    }
}
